﻿using UnityEngine;
using System.Collections;

public class CameraAttachedBG : MonoBehaviour {

	float lastTouchTime;
	public float doubleTouchGapTime = 0.3f;

	void OnMouseDown()
	{
		Vector3 myCheckPos =  Camera.main.ScreenToWorldPoint( Input.mousePosition );
		myCheckPos.z = -500;
		RaycastHit hit = new RaycastHit();
		if(Physics.Raycast(myCheckPos, Vector3.forward, out hit, Mathf.Infinity, 1 << LayerMask.NameToLayer("back_cameraBG") )  )
		{
			if( Time.timeSinceLevelLoad - lastTouchTime < doubleTouchGapTime)
			{
				StageManagerWrapper.camControl.DoDoubleTouch();
			}
			lastTouchTime = Time.timeSinceLevelLoad;
		}

	
	}
}
